package com.qiantu.api.entity;

import com.qiantu.api.db.greendao.DaoSession;
import com.qiantu.api.db.greendao.DeviceBeanDao;
import com.qiantu.api.db.greendao.FloorBeanDao;
import com.qiantu.api.db.greendao.RoomBeanDao;
import com.qiantu.api.db.greendao.SceneBeanDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.JoinProperty;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Unique;
import org.greenrobot.greendao.annotation.Generated;
import java.util.ArrayList;
import java.util.List;

@Entity
public class FloorBean {
    @Id(autoincrement = true)
    private Long id;
    @Unique
    private String floorSerialNo;
    private String houseSerialNo;
    private String floorName;
    //状态 0 正常楼层，1：默认楼层
    private int type;
    private String createTime;
    private int sort;
    private String picUrl;
    @Transient
    private List<RoomBean> rooms;

    @Generated(hash = 1155703354)
    public FloorBean() {
    }

    @Generated(hash = 790162679)
    public FloorBean(Long id, String floorSerialNo, String houseSerialNo,
            String floorName, int type, String createTime, int sort,
            String picUrl) {
        this.id = id;
        this.floorSerialNo = floorSerialNo;
        this.houseSerialNo = houseSerialNo;
        this.floorName = floorName;
        this.type = type;
        this.createTime = createTime;
        this.sort = sort;
        this.picUrl = picUrl;
    }

    public String getFloorSerialNo() {
        return floorSerialNo;
    }

    public void setFloorSerialNo(String floorSerialNo) {
        this.floorSerialNo = floorSerialNo;
    }

    public String getHouseSerialNo() {
        return houseSerialNo;
    }

    public void setHouseSerialNo(String houseSerialNo) {
        this.houseSerialNo = houseSerialNo;
    }

    public String getFloorName() {
        return floorName;
    }

    public void setFloorName(String floorName) {
        this.floorName = floorName;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<RoomBean> getRooms() {
        return rooms;
    }

    public List<String> getRoomNames() {
        List<String> names = new ArrayList<>();
        if (rooms == null || rooms.isEmpty()) return names;
        for (RoomBean bean : rooms){
            names.add(bean.getRoomName());
        }
        return names;
    }

    public void setRooms(List<RoomBean> rooms) {
        this.rooms = rooms;
    }

    public void addRoom(RoomBean roomBean) {
        if (rooms == null){
            rooms = new ArrayList<>();
        }
        rooms.add(roomBean);
    }

    public int getSort() {
        return this.sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public String getPicUrl() {
        return this.picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }


}
